package cn.zhangxin.pethome.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfigurer implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                //拦截地址
                .addPathPatterns("/**")
                //放行地址
                .excludePathPatterns("/fast/**")//放行图片上传下载
                .excludePathPatterns("/logininfo/account")//放行登录
                .excludePathPatterns("/shopAuditLog/**")//
                .excludePathPatterns("/vcode/**")//发送图片验证码和短信
                .excludePathPatterns("/login/**")//微信扫码登录
                .excludePathPatterns("/shop")//店铺注册
                .excludePathPatterns("/pet/**")//获得上架宠物
                .excludePathPatterns("/product/frontGetList")
                .excludePathPatterns("/product/**")
                .excludePathPatterns("/productComment/**");
    }
}